﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BIExtAuth.DBUtility
{
    /// <summary>
    /// ClassName：数据提供类型
    /// Author：scc-john
    /// CreateDate：2013-09-22
    /// </summary>
    public class ProviderType
    {
        /// <summary>
        /// 根据名称获取数据提供程序类型
        /// </summary>
        /// <param name="name">数据提供程序名称</param>
        /// <returns>数据连接提供程序类型</returns>
        public static Providers GetProviderByName(string name)
        {
            Providers p = Providers.SqlServer;
            switch (name)
            {
                case "System.Data.OleDb":
                    p = Providers.OleDb;
                    break;
                case "System.Data.Odbc":
                    p = Providers.ODBC;
                    break;
                case "System.Data.SqlClient":
                    p = Providers.SqlServer;
                    break;
                default:
                    p = Providers.ConfigDefined;
                    break;
            }
            return p;
        }
    }

    #region 数据连接提供程序类型
    /// <summary>
    /// 数据连接提供程序类型
    /// </summary>
    public enum Providers
    {
        /// <summary>
        /// SqlClient
        /// </summary>
        SqlServer,
        /// <summary>
        /// OleDb
        /// </summary>
        OleDb,
        /// <summary>
        /// Odbc
        /// </summary>
        ODBC,
        /// <summary>
        /// 根据config文件自定义
        /// </summary>
        ConfigDefined
    }
    #endregion
}
